//
//  DataVisitor.h
//  CToolBox
//
//  Created by SC on 16/12/13.
//  Copyright © 2016年 SC. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NetWorkManager.h"
#import "GeneralModelDefine.h"
#import "JSONValueTransformer+CustomTransformer.h"

extern NSString *const YJActionInfoPostNotification;
@interface DataVisitor : NSObject{
    
    @protected
    
    NSString *area;
    
}

@property (nonatomic, assign) id<CTVisitorDelegate> delegate;


/**
 *  获取数据的方法--get
 *
 *  @param url          请求的url
 *  @param params       请求的参数
 *  @param tag          标示
 *  @param expireLength 缓存过期的时长
 *  @param success     请求成功的回调
 *  @param failure     请求失败的回调
 */
- (NSString *)executeGETWithUrl:(NSString *)url
                   Params:(NSDictionary *)params
                      tag:(id)tag
             expireLength:(long)expireLength
             successBlock:(succeedBlock)success
             failureBlock:(failureBlock)failure;

/**
 *  获取数据的方法--post
 *
 *  @param url      请求的url
 *  @param params   请求的参数
 *  @param tag      标示
 *  @param success     请求成功的回调
 *  @param failure     请求失败的回调
 */
- (void)executePOSTWithUrl:(NSString *)url
                    Params:(NSDictionary *)params
                       tag:(id)tag
              successBlock:(succeedBlock)success
              failureBlock:(failureBlock)failure;


/**
 *  获取网络数据的方法--get (只获得网络数据)
 *
 *  @param url          请求的url
 *  @param params       请求的参数
 *  @param tag          标示
 *  @param expireLength 缓存过期的时长
 *  @param success     请求成功的回调
 *  @param failure     请求失败的回调
 */
- (void)getRemoteDataWithUrl:(NSString *)url
                      params:(NSDictionary *)params
                         tag:(id)tag
                expireLength:(long)expireLength
                successBlock:(succeedBlock)success
                failureBlock:(failureBlock)failure;


/**
 *  获取本地缓存数据的方法
 *
 *  @param key           获取缓存数据的key
 *  @param cacheComplete 缓存有效回调
 */
- (void)getLocalDataWithKey:(NSString *)key
                   complete:(cacheCompleteBlock)cacheComplete;

/**
 *  存储本地缓存数据的方法
 *
 *  @param key     存储缓存数据的key
 *  @param object  存储数据
 */
- (void)setLocalDataWithKey:(NSString *)key
                     object:(NSDictionary *)object
               expireLength:(long)expireLength;




//下载
- (void)downloadDateWithUrl:(NSString*)url
                 pathString:(NSString *)pathString
           downloadResponse:(downloadSuccessBlock)downloadResponse
   downloadProgressResponse:(downloadProgressBlock)downloadProgressResponse;

/*
 *  取消全部网络请求
 */
+ (void)cancelAllRequest;

/*
 *  取消单个网络请求
 */
- (void)cancelSingleRequest;





@end
